<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__sysclk__path__src__funcs.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Functions<div class="ingroups"><a class="el" href="group__group__sysclk.html">SysClk       (System Clock)</a> &raquo; <a class="el" href="group__group__sysclk__path__src.html">Clock Path Source</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga517f603266062d0013947ea950ed5b60"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__path__src__funcs.html#ga517f603266062d0013947ea950ed5b60">Cy_SysClk_ClkPathSetSource</a> (uint32_t clkPath, <a class="el" href="group__group__sysclk__path__src__enums.html#ga8ddaf9023a02dee0d1f9a5629d6ccfe6">cy_en_clkpath_in_sources_t</a> source)</td></tr>
<tr class="memdesc:ga517f603266062d0013947ea950ed5b60"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configures the source for the specified clock path.  <a href="#ga517f603266062d0013947ea950ed5b60">More...</a><br /></td></tr>
<tr class="separator:ga517f603266062d0013947ea950ed5b60"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab1c9f683f870696d41786c3df1eb331b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sysclk__path__src__enums.html#ga8ddaf9023a02dee0d1f9a5629d6ccfe6">cy_en_clkpath_in_sources_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__path__src__funcs.html#gab1c9f683f870696d41786c3df1eb331b">Cy_SysClk_ClkPathGetSource</a> (uint32_t clkPath)</td></tr>
<tr class="memdesc:gab1c9f683f870696d41786c3df1eb331b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reports which source is selected for the path mux.  <a href="#gab1c9f683f870696d41786c3df1eb331b">More...</a><br /></td></tr>
<tr class="separator:gab1c9f683f870696d41786c3df1eb331b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1256c8a7290cecf2b9553a1df582e797"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__path__src__funcs.html#ga1256c8a7290cecf2b9553a1df582e797">Cy_SysClk_ClkPathMuxGetFrequency</a> (uint32_t clkPath)</td></tr>
<tr class="memdesc:ga1256c8a7290cecf2b9553a1df582e797"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the output frequency of the clock path mux.  <a href="#ga1256c8a7290cecf2b9553a1df582e797">More...</a><br /></td></tr>
<tr class="separator:ga1256c8a7290cecf2b9553a1df582e797"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga54c618c89782d227fb8f292d1dc15625"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__path__src__funcs.html#ga54c618c89782d227fb8f292d1dc15625">Cy_SysClk_ClkPathGetFrequency</a> (uint32_t clkPath)</td></tr>
<tr class="memdesc:ga54c618c89782d227fb8f292d1dc15625"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the output frequency of the clock path mux.  <a href="#ga54c618c89782d227fb8f292d1dc15625">More...</a><br /></td></tr>
<tr class="separator:ga54c618c89782d227fb8f292d1dc15625"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga517f603266062d0013947ea950ed5b60"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga517f603266062d0013947ea950ed5b60">&#9670;&nbsp;</a></span>Cy_SysClk_ClkPathSetSource()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a> Cy_SysClk_ClkPathSetSource </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>clkPath</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__sysclk__path__src__enums.html#ga8ddaf9023a02dee0d1f9a5629d6ccfe6">cy_en_clkpath_in_sources_t</a>&#160;</td>
          <td class="paramname"><em>source</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configures the source for the specified clock path. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">clkPath</td><td>Selects which clock path to configure; 0 is the first clock path, which is the FLL.</td></tr>
    <tr><td class="paramname">source</td><td><a class="el" href="group__group__sysclk__path__src__enums.html#ga8ddaf9023a02dee0d1f9a5629d6ccfe6">cy_en_clkpath_in_sources_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a> CY_PRA_STATUS_* - For the PSoC 64 devices there are possible situations when function returns the PRA error status code <a class="el" href="group__group__pra__enums.html#ga60be13e12e82986f8c0d6c6a6d4f12c5">cy_en_pra_status_t</a> instead of <a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a>. This is because for PSoC 64 devices the function uses the PRA driver to change the protected registers. Refer to <a class="el" href="group__group__pra__enums.html#ga60be13e12e82986f8c0d6c6a6d4f12c5">cy_en_pra_status_t</a> for more details.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>If calling this function changes an FLL or PLL input frequency, disable the FLL or PLL before calling this function. After calling this function, call the FLL or PLL configure function, for example <a class="el" href="group__group__sysclk__fll__funcs.html#gad9d9c36d022475746375bddaba2b2065">Cy_SysClk_FllConfigure()</a>.</dd>
<dd>
Call <a class="el" href="group__group__startup__config__system__functions.html#gae0c36a9591fe6e9c45ecb21a794f0f0f">SystemCoreClockUpdate</a> after this function calling if it affects the CLK_HF0 frequency.</dd>
<dd>
Call <a class="el" href="group__group__syslib__functions.html#ga8b897f8554957f9393f645d5ab1106c9">Cy_SysLib_SetWaitStates</a> before calling this function if it affects the CLK_HF0 frequency and the frequency is increasing.</dd>
<dd>
Call <a class="el" href="group__group__syslib__functions.html#ga8b897f8554957f9393f645d5ab1106c9">Cy_SysLib_SetWaitStates</a> after calling this function if it affects the CLK_HF0 frequency and the frequency is decreasing.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: ECO needs to source HFCLK2 through Path 2. The ECO is</span></div><div class="line"><span class="comment">                 configured through its function calls. */</span></div><div class="line"></div><div class="line"><span class="preprocessor">    #define CLKPATH2 (2UL)</span></div><div class="line"><span class="preprocessor">    #define HFCLK2 (2UL)</span></div><div class="line"></div><div class="line">    uint32_t clkPathMuxFreq = 0UL; <span class="comment">/* Variable to store the Clock Path Mux output frequency */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Set the clock path 2 mux to be sourced from ECO */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__sysclk__returns.html#ggad6699a184e2e3c01433251b0981558f3a1563f761f963757b339ff05eb5a690ec">CY_SYSCLK_SUCCESS</a> == <a class="code" href="group__group__sysclk__path__src__funcs.html#ga517f603266062d0013947ea950ed5b60">Cy_SysClk_ClkPathSetSource</a>(CLKPATH2, <a class="code" href="group__group__sysclk__path__src__enums.html#gga8ddaf9023a02dee0d1f9a5629d6ccfe6a28f5ad80fd20d8459d40aa8b86d3a77e">CY_SYSCLK_CLKPATH_IN_ECO</a>))</div><div class="line">    {</div><div class="line">        clkPathMuxFreq = <a class="code" href="group__group__sysclk__path__src__funcs.html#ga1256c8a7290cecf2b9553a1df582e797">Cy_SysClk_ClkPathMuxGetFrequency</a>(CLKPATH2);</div><div class="line">        <span class="comment">/* Now clkPathMuxFreq contains the Clock Path Mux output frequency */</span></div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <span class="comment">/* Perform error handling */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Set the HFCLK2 source to clock path 2 and enable HFCLK2 */</span></div><div class="line">    (void)<a class="code" href="group__group__sysclk__clk__hf__funcs.html#ga2d39c7e5111f9ba0738f032a98b4593e">Cy_SysClk_ClkHfSetSource</a>(HFCLK2, <a class="code" href="group__group__sysclk__clk__hf__enums.html#ggabac2d6b9124a00860dcd781a922788d6a7a35a9d5b37d1add71bd6f866953366e">CY_SYSCLK_CLKHF_IN_CLKPATH2</a>);</div><div class="line"></div><div class="line">    <span class="comment">/* Enable HFCLK2  */</span></div><div class="line">    (void)<a class="code" href="group__group__sysclk__clk__hf__funcs.html#gaf3041fc8333478cc7c8d869d2a535d71">Cy_SysClk_ClkHfEnable</a>(HFCLK2);</div></div><!-- fragment --> </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Take into account the possible platform specific clkHf (and further clocking chain links) frequency limitations while using this API.</dd>
<dd>
It takes four cycles of the originally selected clock to switch away from it. Do not disable the original clock during this time. </dd></dl>

</div>
</div>
<a id="gab1c9f683f870696d41786c3df1eb331b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab1c9f683f870696d41786c3df1eb331b">&#9670;&nbsp;</a></span>Cy_SysClk_ClkPathGetSource()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sysclk__path__src__enums.html#ga8ddaf9023a02dee0d1f9a5629d6ccfe6">cy_en_clkpath_in_sources_t</a> Cy_SysClk_ClkPathGetSource </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>clkPath</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reports which source is selected for the path mux. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">clkPath</td><td>Selects which clock path to report; 0 is the first clock path, which is the FLL.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__sysclk__path__src__enums.html#ga8ddaf9023a02dee0d1f9a5629d6ccfe6">cy_en_clkpath_in_sources_t</a></dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: A peripheral derived off of Path 1 clock is not clocking at the</span></div><div class="line"><span class="comment">                 expected frequency and accuracy. Need to confirm that the source</span></div><div class="line"><span class="comment">                 of the Path 1 mux is the ECO. */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Get the source of the clock path 1 mux  */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__sysclk__path__src__enums.html#gga8ddaf9023a02dee0d1f9a5629d6ccfe6a28f5ad80fd20d8459d40aa8b86d3a77e">CY_SYSCLK_CLKPATH_IN_ECO</a> != <a class="code" href="group__group__sysclk__path__src__funcs.html#gab1c9f683f870696d41786c3df1eb331b">Cy_SysClk_ClkPathGetSource</a>(1UL))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga1256c8a7290cecf2b9553a1df582e797"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1256c8a7290cecf2b9553a1df582e797">&#9670;&nbsp;</a></span>Cy_SysClk_ClkPathMuxGetFrequency()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t Cy_SysClk_ClkPathMuxGetFrequency </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>clkPath</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the output frequency of the clock path mux. </p>
<dl class="section return"><dt>Returns</dt><dd>The output frequency of the path mux.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>If the return value equals zero, that means either:<ul>
<li>the selected path mux source signal frequency is unknown (e.g. dsi_out, etc.) or</li>
<li>the selected path mux source is not configured/enabled/stable (e.g. ECO, EXTCLK, etc.).</li>
</ul>
</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: ECO needs to source HFCLK2 through Path 2. The ECO is</span></div><div class="line"><span class="comment">                 configured through its function calls. */</span></div><div class="line"></div><div class="line"><span class="preprocessor">    #define CLKPATH2 (2UL)</span></div><div class="line"><span class="preprocessor">    #define HFCLK2 (2UL)</span></div><div class="line"></div><div class="line">    uint32_t clkPathMuxFreq = 0UL; <span class="comment">/* Variable to store the Clock Path Mux output frequency */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Set the clock path 2 mux to be sourced from ECO */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__sysclk__returns.html#ggad6699a184e2e3c01433251b0981558f3a1563f761f963757b339ff05eb5a690ec">CY_SYSCLK_SUCCESS</a> == <a class="code" href="group__group__sysclk__path__src__funcs.html#ga517f603266062d0013947ea950ed5b60">Cy_SysClk_ClkPathSetSource</a>(CLKPATH2, <a class="code" href="group__group__sysclk__path__src__enums.html#gga8ddaf9023a02dee0d1f9a5629d6ccfe6a28f5ad80fd20d8459d40aa8b86d3a77e">CY_SYSCLK_CLKPATH_IN_ECO</a>))</div><div class="line">    {</div><div class="line">        clkPathMuxFreq = <a class="code" href="group__group__sysclk__path__src__funcs.html#ga1256c8a7290cecf2b9553a1df582e797">Cy_SysClk_ClkPathMuxGetFrequency</a>(CLKPATH2);</div><div class="line">        <span class="comment">/* Now clkPathMuxFreq contains the Clock Path Mux output frequency */</span></div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <span class="comment">/* Perform error handling */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Set the HFCLK2 source to clock path 2 and enable HFCLK2 */</span></div><div class="line">    (void)<a class="code" href="group__group__sysclk__clk__hf__funcs.html#ga2d39c7e5111f9ba0738f032a98b4593e">Cy_SysClk_ClkHfSetSource</a>(HFCLK2, <a class="code" href="group__group__sysclk__clk__hf__enums.html#ggabac2d6b9124a00860dcd781a922788d6a7a35a9d5b37d1add71bd6f866953366e">CY_SYSCLK_CLKHF_IN_CLKPATH2</a>);</div><div class="line"></div><div class="line">    <span class="comment">/* Enable HFCLK2  */</span></div><div class="line">    (void)<a class="code" href="group__group__sysclk__clk__hf__funcs.html#gaf3041fc8333478cc7c8d869d2a535d71">Cy_SysClk_ClkHfEnable</a>(HFCLK2);</div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga54c618c89782d227fb8f292d1dc15625"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga54c618c89782d227fb8f292d1dc15625">&#9670;&nbsp;</a></span>Cy_SysClk_ClkPathGetFrequency()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t Cy_SysClk_ClkPathGetFrequency </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>clkPath</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the output frequency of the clock path mux. </p>
<dl class="section return"><dt>Returns</dt><dd>The output frequency of the path mux.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>If the return value equals zero, that means either:<ul>
<li>the selected path mux source signal frequency is unknown (e.g. dsi_out, etc.) or</li>
<li>the selected path mux source is not configured/enabled/stable (e.g. ECO, EXTCLK, etc.).</li>
</ul>
</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: FLL is configured and needs to be enabled within 2 ms */</span></div><div class="line"></div><div class="line"><span class="preprocessor">    #define CLKPATH0 (0UL)</span></div><div class="line"></div><div class="line">    uint32_t clkPathFreq = 0UL; <span class="comment">/* Variable to store the Clock Path output frequency */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Enable the FLL with a timeout of 2000 microseconds */</span></div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="group__group__sysclk__returns.html#ggad6699a184e2e3c01433251b0981558f3a1563f761f963757b339ff05eb5a690ec">CY_SYSCLK_SUCCESS</a> == <a class="code" href="group__group__sysclk__fll__funcs.html#ga5a008909d3f50d85fb8d8c9f56ed8886">Cy_SysClk_FllEnable</a>(2000UL))</div><div class="line">    {</div><div class="line">        clkPathFreq = <a class="code" href="group__group__sysclk__path__src__funcs.html#ga54c618c89782d227fb8f292d1dc15625">Cy_SysClk_ClkPathGetFrequency</a>(CLKPATH0);</div><div class="line">        <span class="comment">/* Now clkPathFreq contains an actual FLL frequency */</span></div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --></dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
